bitkeeper revision 1.1159.187.27 (41a99261iejadhs-BVt7TOiimzafww)
authorkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sun, 28 Nov 2004 08:54:57 +0000 (08:54 +0000)
committerkaf24@scramble.cl.cam.ac.uk <kaf24@scramble.cl.cam.ac.uk>
Sun, 28 Nov 2004 08:54:57 +0000 (08:54 +0000)
Fix IOPL handling.
 1. Both Linux 2.4 and 2.6 were not correctly setting IOPL during context
    switch (they sent a bogus dom0_op with a bad version number).
 2. The switch_vm86 hypercall was corrupting EFLAGS and setting IOPL==0.

linux-2.4.28-xen-sparse/arch/xen/kernel/process.c
linux-2.6.9-xen-sparse/arch/xen/i386/kernel/process.c
xen/arch/x86/x86_32/entry.S

index f2e32dcfd49d8499977c22021c6c061c07cc71cb..ad7e82dc7904a796260149b13a7cc8bf25ef38d1 100644 (file)
@@ -344,6 +344,7 @@ void fastcall __switch_to(struct task_struct *prev_p, struct task_struct *next_p
         op.cmd           = DOM0_IOPL;
         op.u.iopl.domain = DOMID_SELF;
         op.u.iopl.iopl   = next->io_pl;
+        op.interface_version = DOM0_INTERFACE_VERSION;
         queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
     }
 
index 1552e00db793e6e0147c9e6946a31ca54556c2d1..aabca9cba1d078e044c7062ecf02df1e14cd6991 100644 (file)
@@ -534,6 +534,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
                op.cmd           = DOM0_IOPL;
                op.u.iopl.domain = DOMID_SELF;
                op.u.iopl.iopl   = next->io_pl;
+               op.interface_version = DOM0_INTERFACE_VERSION;
                queue_multicall1(__HYPERVISOR_dom0_op, (unsigned long)&op);
        }
 
index 4bfcb945d34203bbc500bd15313381a87eb03694..1befb2828dfea8e14198123310bef496bc65310e 100644 (file)
@@ -585,8 +585,8 @@ do_switch_vm86:
         # Discard the return address
         addl $4,%esp
 
-        movl XREGS_eflags(%esp),%ecx
-                
+        movl XREGS_eflags(%esp),%edx
+
         # GS:ESI == Ring-1 stack activation
         movl XREGS_esp(%esp),%esi
 VFLT1:  movl XREGS_ss(%esp),%gs
@@ -608,11 +608,11 @@ VFLT3:  movl %gs:(%esi),%eax
 
         # Fix up EFLAGS
         andl $~X86_EFLAGS_IOPL,XREGS_eflags(%esp)
-        andl $X86_EFLAGS_IOPL,%ecx # Ignore attempts to change EFLAGS.IOPL
+        andl $X86_EFLAGS_IOPL,%edx # Ignore attempts to change EFLAGS.IOPL
         jnz  1f
-        orl  $X86_EFLAGS_IF,%ecx   # EFLAGS.IOPL=0 => no messing with EFLAGS.IF
-1:      orl  $X86_EFLAGS_VM,%ecx   # Force EFLAGS.VM
-        orl  %ecx,XREGS_eflags(%esp)
+        orl  $X86_EFLAGS_IF,%edx   # EFLAGS.IOPL=0 => no messing with EFLAGS.IF
+1:      orl  $X86_EFLAGS_VM,%edx   # Force EFLAGS.VM
+        orl  %edx,XREGS_eflags(%esp)
         
         jmp test_all_events